package net.asrsmid.connection;


/**
 * @author Chen WANG
 * @since 05 May 2011
 */
public abstract class AsRsPoolableConnection {
	protected AsRsConnectionPool pool;

	/**
	 * @param pool
	 */
	public final void register(AsRsConnectionPool pool) {
		this.pool = pool;
	}
	
	public final void unregister() {
		if (this.pool != null) {
			try {
				pool.invalidateObject(this);
				pool.returnObject(this);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

	/**
	 * @return the pool
	 */
	/*public AsRsConnectionPool getPool() {
		return pool;
	}*/
	
	public abstract void release();
}